$OpenBSD: patch-src_sakura_c,v 1.2 2014/12/29 07:35:19 bcallah Exp $

https://bugs.launchpad.net/sakura/+bug/1337962

--- src/sakura.c.orig	Wed Dec 10 12:19:47 2014
+++ src/sakura.c	Mon Dec 29 02:26:38 2014
@@ -225,7 +225,7 @@ static struct {
 	glong columns;
 	glong rows;
 	gint label_count;
-	VteTerminalCursorShape cursor_type;
+	VteCursorShape cursor_type;
 	bool first_tab;
 	bool show_scrollbar;
 	bool show_resize_grip;
@@ -283,7 +283,7 @@ struct terminal {
 	GtkWidget *label;
 	gchar *label_text;
 	bool label_set_byuser;
-	GtkBorder *border;   /* inner-property data */
+	GtkBorder padding;   /* inner-property data */
 	int colorset;
 };
 
@@ -860,7 +860,7 @@ sakura_delete_event (GtkWidget *widget, void *data)
 		for (i=0; i < npages; i++) {
 
 			term = sakura_get_page_term(sakura, i);
-			pgid = tcgetpgrp(vte_terminal_get_pty(VTE_TERMINAL(term->vte)));
+			pgid = tcgetpgrp(vte_pty_get_fd(vte_terminal_get_pty(VTE_TERMINAL(term->vte))));
 
 			/* If running processes are found, we ask one time and exit */
 			if ( (pgid != -1) && (pgid != term->pid)) {
@@ -1012,14 +1012,14 @@ sakura_set_colors ()
 			/* This is needed for set_opacity to have effect. The opacity does
 			   take effect when switching tabs, so this setting to white is 
 			   actually needed only in the shown tab.*/
-			vte_terminal_set_color_background_rgba(VTE_TERMINAL (term->vte), &white);
-			vte_terminal_set_opacity(VTE_TERMINAL (term->vte), (int)((sakura.backcolors[term->colorset].alpha)*65535));
+			vte_terminal_set_color_background(VTE_TERMINAL (term->vte), &white);
+			//vte_terminal_set_opacity(VTE_TERMINAL (term->vte), (int)((sakura.backcolors[term->colorset].alpha)*65535));
 		}
-		vte_terminal_set_colors_rgba(VTE_TERMINAL(term->vte), 
+		vte_terminal_set_colors(VTE_TERMINAL(term->vte), 
 		                        &sakura.forecolors[term->colorset], 
 		                        &sakura.backcolors[term->colorset],
 		                        sakura.palette, PALETTE_SIZE);
-		vte_terminal_set_color_cursor_rgba(VTE_TERMINAL(term->vte), &sakura.curscolors[term->colorset]);
+		vte_terminal_set_color_cursor(VTE_TERMINAL(term->vte), &sakura.curscolors[term->colorset]);
 	}
 
 }
@@ -1340,7 +1340,7 @@ sakura_clear (GtkWidget *widget, void *data)
 
 	gtk_widget_hide(sakura.item_clear_background);
 
-	vte_terminal_set_background_image(VTE_TERMINAL(term->vte), NULL);
+	//vte_terminal_set_background_image(VTE_TERMINAL(term->vte), NULL);
 
 	sakura_set_config_string("background", "none");
 
@@ -1478,10 +1478,10 @@ sakura_visible_bell (GtkWidget *widget, void *data)
 	term = sakura_get_page_term(sakura, page);
 
 	if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) {
-		vte_terminal_set_visible_bell (VTE_TERMINAL(term->vte), TRUE);
+		//vte_terminal_set_visible_bell (VTE_TERMINAL(term->vte), TRUE);
 		sakura_set_config_string("visible_bell", "Yes");
 	} else {
-		vte_terminal_set_visible_bell (VTE_TERMINAL(term->vte), FALSE);
+		//vte_terminal_set_visible_bell (VTE_TERMINAL(term->vte), FALSE);
 		sakura_set_config_string("visible_bell", "No");
 	}
 }
@@ -1579,11 +1579,11 @@ sakura_set_palette(GtkWidget *widget, void *data)
 
 		for (i = (n_pages - 1); i >= 0; i--) {
 			term = sakura_get_page_term(sakura, i);
-			vte_terminal_set_colors_rgba(VTE_TERMINAL(term->vte),
+			vte_terminal_set_colors(VTE_TERMINAL(term->vte),
 			                        &sakura.forecolors[term->colorset], 
 			                        &sakura.backcolors[term->colorset],
 			                        sakura.palette, PALETTE_SIZE);
-			vte_terminal_set_color_cursor_rgba(VTE_TERMINAL(term->vte), &sakura.curscolors[term->colorset]);
+			vte_terminal_set_color_cursor(VTE_TERMINAL(term->vte), &sakura.curscolors[term->colorset]);
 		}
 
 		sakura_set_config_string("palette", palette);
@@ -1713,7 +1713,7 @@ sakura_close_tab (GtkWidget *widget, void *data)
 	}
 
 	/* Check if there are running processes for this tab. Use tcgetpgrp to compare to the shell PGID */
-	pgid = tcgetpgrp(vte_terminal_get_pty(VTE_TERMINAL(term->vte)));
+	pgid = tcgetpgrp(vte_pty_get_fd(vte_terminal_get_pty(VTE_TERMINAL(term->vte))));
 	
 	if ( (pgid != -1) && (pgid != term->pid) && (!sakura.less_questions) ) {
 			dialog=gtk_message_dialog_new(GTK_WINDOW(sakura.main_window), GTK_DIALOG_MODAL,
@@ -1769,7 +1769,7 @@ sakura_closebutton_clicked(GtkWidget *widget, void *da
 	}
 
 	/* Check if there are running processes for this tab. Use tcgetpgrp to compare to the shell PGID */
-	pgid = tcgetpgrp(vte_terminal_get_pty(VTE_TERMINAL(term->vte)));
+	pgid = tcgetpgrp(vte_pty_get_fd(vte_terminal_get_pty(VTE_TERMINAL(term->vte))));
 	
 	if ( (pgid != -1) && (pgid != term->pid) && (!sakura.less_questions) ) {
 			dialog=gtk_message_dialog_new(GTK_WINDOW(sakura.main_window), GTK_DIALOG_MODAL,
@@ -2510,9 +2510,11 @@ sakura_set_size(void)
 		sakura.resized=FALSE;
 	}
 
-	gtk_widget_style_get(term->vte, "inner-border", &term->border, NULL);
-	pad_x = term->border->left + term->border->right;
-	pad_y = term->border->top + term->border->bottom;
+	gtk_style_context_get_padding(gtk_widget_get_style_context(term->vte),
+		gtk_widget_get_state_flags(term->vte),
+		&term->padding);
+	pad_x = term->padding.left + term->padding.right;
+	pad_y = term->padding.top + term->padding.bottom;
 	SAY("padding x %d y %d", pad_x, pad_y);
 	char_width = vte_terminal_get_char_width(VTE_TERMINAL(term->vte));
 	char_height = vte_terminal_get_char_height(VTE_TERMINAL(term->vte));
@@ -2696,7 +2698,7 @@ sakura_add_tab()
 	vte_terminal_match_add_gregex(VTE_TERMINAL(term->vte), sakura.http_regexp, 0);
 	vte_terminal_set_mouse_autohide(VTE_TERMINAL(term->vte), TRUE);
 
-	term->scrollbar=gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, vte_terminal_get_adjustment(VTE_TERMINAL(term->vte)));
+	term->scrollbar=gtk_vscrollbar_new(gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(term->vte)));
 
 	gtk_box_pack_start(GTK_BOX(term->hbox), term->vte, TRUE, TRUE, 0);
 	gtk_box_pack_start(GTK_BOX(term->hbox), term->scrollbar, FALSE, FALSE, 0);
@@ -2833,8 +2835,8 @@ sakura_add_tab()
 			if (command_argc > 0) {
 				path=g_find_program_in_path(command_argv[0]);
 				if (path) {
-					if (!vte_terminal_fork_command_full(VTE_TERMINAL(term->vte), VTE_PTY_NO_HELPER, NULL,
-				 	    command_argv, command_env, G_SPAWN_SEARCH_PATH, NULL, NULL, &term->pid, &gerror)) {
+					if (!vte_terminal_spawn_sync(VTE_TERMINAL(term->vte), VTE_PTY_DEFAULT, NULL, command_argv, NULL,
+							G_SPAWN_SEARCH_PATH, NULL, NULL, &term->pid, NULL, &gerror)) {
 						SAY("error: %s", gerror->message);
 					}
 				} else {
@@ -2853,8 +2855,8 @@ sakura_add_tab()
 				sakura_error("Hold option given without any command");
 				option_hold=FALSE;
 			}
-			vte_terminal_fork_command_full(VTE_TERMINAL(term->vte), VTE_PTY_NO_HELPER, cwd, sakura.argv, command_env,
-						       G_SPAWN_SEARCH_PATH|G_SPAWN_FILE_AND_ARGV_ZERO, NULL, NULL, &term->pid, NULL);
+			vte_terminal_spawn_sync(VTE_TERMINAL(term->vte), VTE_PTY_DEFAULT, cwd, sakura.argv, NULL,
+										   G_SPAWN_SEARCH_PATH|G_SPAWN_FILE_AND_ARGV_ZERO, NULL, NULL, &term->pid, NULL, NULL);
 		}
 	/* Not the first tab */
 	} else {
@@ -2872,23 +2874,23 @@ sakura_add_tab()
 		 * function in the window is not visible *sigh*. Gtk documentation
 		 * says this is for "historical" reasons. Me arse */
 		gtk_notebook_set_current_page(GTK_NOTEBOOK(sakura.notebook), index);
-		vte_terminal_fork_command_full(VTE_TERMINAL(term->vte), VTE_PTY_NO_HELPER, cwd, sakura.argv, command_env,
-					       G_SPAWN_SEARCH_PATH|G_SPAWN_FILE_AND_ARGV_ZERO, NULL, NULL, &term->pid, NULL);
+		vte_terminal_spawn_sync(VTE_TERMINAL(term->vte), VTE_PTY_DEFAULT, cwd, sakura.argv, NULL,
+									   G_SPAWN_SEARCH_PATH|G_SPAWN_FILE_AND_ARGV_ZERO, NULL, NULL, &term->pid, NULL, NULL);
 	}
 
 	free(cwd);
 
 	/* Configuration for the newly created terminal */
 	GdkRGBA white={255, 255, 255, 1};
-	vte_terminal_set_color_background_rgba(VTE_TERMINAL (term->vte), &white);
+	vte_terminal_set_color_background(VTE_TERMINAL (term->vte), &white);
 	vte_terminal_set_backspace_binding(VTE_TERMINAL(term->vte), VTE_ERASE_ASCII_DELETE);
-	vte_terminal_set_colors_rgba(VTE_TERMINAL(term->vte), 
+	vte_terminal_set_colors(VTE_TERMINAL(term->vte), 
 							  &sakura.forecolors[term->colorset],
 							  &sakura.backcolors[term->colorset],
 							  sakura.palette, PALETTE_SIZE);
-	vte_terminal_set_color_cursor_rgba(VTE_TERMINAL(term->vte), &sakura.curscolors[term->colorset]);
+	vte_terminal_set_color_cursor(VTE_TERMINAL(term->vte), &sakura.curscolors[term->colorset]);
 	if (sakura.has_rgba) {
-		vte_terminal_set_opacity(VTE_TERMINAL (term->vte), (int)((sakura.backcolors[term->colorset].alpha)*65535));
+		//vte_terminal_set_opacity(VTE_TERMINAL (term->vte), (int)((sakura.backcolors[term->colorset].alpha)*65535));
 	}
 
 	if (sakura.background) {
@@ -2896,12 +2898,12 @@ sakura_add_tab()
 	}
 
 	if (sakura.word_chars) {
-		vte_terminal_set_word_chars( VTE_TERMINAL (term->vte), sakura.word_chars );
+		//vte_terminal_set_word_chars( VTE_TERMINAL (term->vte), sakura.word_chars );
 	}
 
 	/* Get rid of these nasty bells */
 	vte_terminal_set_audible_bell (VTE_TERMINAL(term->vte), sakura.audible_bell ? TRUE : FALSE);
-	vte_terminal_set_visible_bell (VTE_TERMINAL(term->vte), sakura.visible_bell ? TRUE : FALSE);
+	//vte_terminal_set_visible_bell (VTE_TERMINAL(term->vte), sakura.visible_bell ? TRUE : FALSE);
 
 	/* Disable stupid blinking cursor */
 	vte_terminal_set_cursor_blink_mode (VTE_TERMINAL(term->vte), sakura.blinking_cursor ? VTE_CURSOR_BLINK_ON : VTE_CURSOR_BLINK_OFF);
@@ -2986,9 +2988,9 @@ sakura_set_bgimage(char *infile)
 		if (!pixbuf) {
 			sakura_error("Error loading image file: %s\n", gerror->message);
 		} else {
-			vte_terminal_set_background_image(VTE_TERMINAL(term->vte), pixbuf);
-			vte_terminal_set_background_saturation(VTE_TERMINAL(term->vte), TRUE);
-			vte_terminal_set_background_transparent(VTE_TERMINAL(term->vte),FALSE);
+			//vte_terminal_set_background_image(VTE_TERMINAL(term->vte), pixbuf);
+			//vte_terminal_set_background_saturation(VTE_TERMINAL(term->vte), TRUE);
+			//vte_terminal_set_background_transparent(VTE_TERMINAL(term->vte),FALSE);
 
 			sakura_set_config_string("background", infile);
 		}
